home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5109 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: news.infinet.com!bgardner
  2. From: bgardner@infinet.com (Brian W. Gardner)
  3. Newsgroups: comp.lang.c++
  4. Subject: [Q] on Garbage Collection in mixed C/C++
  5. Date: 2 Feb 1996 15:35:14 GMT
  6. Organization: InfiNet
  7. Message-ID: <4etavi$4im@news1.infinet.com>
  8. NNTP-Posting-Host: rigel.infinet.com
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I have a situation where I need to mix C functions with C++ in a system
  12. that creates objects (using the new operator) that need to be deleted
  13. in another function. This is a "script" based system, where user-defined
  14. scripts are executed which create certain objects. When a particular
  15. script is complete, all the objects need to be destroyed from memory
  16. (garbage collection). As a real time system that runs continuously, receiving
  17. requests from different hosts on a network, I do not have the luxury
  18. of just allowing things to go out of scope; the main() could execute
  19. for weeks, allocating new objects until the system crashes. 
  20.  
  21. What I need is a way to keep a list of all the objects that are instantiated
  22. so that when a given script has run, a function which is called (a psuedo-
  23. destructor) will clean up all the memory that has been allocated by that
  24. given script (the "scripts" I am referring to are an OO language that
  25. was developed by my company to simplify applications. The C++ work that
  26. is joined to it is a database access library).
  27.  
  28. If anyone has any advice to offer, in terms of referrences or algorythms
  29. or patterns, or whatever, I would be MOST appreciative! I have been
  30. very gratified with the advice I have received by those in this group who
  31. take the time to help others get the job done. I consider it the highest
  32. form of professionalism to work towards improving the lot of the
  33. programming community at large. Kudos to you all!
  34.  
  35. --
  36. Brian W. Gardner                       "Captain, I protest; I am not a
  37. 495 Park Blvd.                          merry man!" - Lt. Worf
  38. Worthington, OH 43085
  39. bgardner@infinet.com (home)            bgardner@hublink.com (office)
  40.